package com.hnkywl.sts.action.organ;

import com.hnkywl.sts.service.organ.YsgjService;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 13-3-29
 * Time: 下午3:29
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/organ/ysgj")
public class YsgjAction extends SimpleActionSupport {
    private YsgjService ysgjService;
    //分页组件 起始位置
    private int page;
    //分页组件 页面大小
    private int rows = 10;
    private Long wlsId;
    private Long ysgjId;


    @Action("ysgjList")
    public void ysgjList() {
        if (wlsId != null) {
            this.renderText(this.ysgjService.findXm(wlsId, 0, -1));
        } else if (wlsId == null) {
            this.renderText("[]");
        }

    }

    @Action("delete_ysgj")
    public   void deleteYsgj(){
        try{
            this.ysgjService.deleteYsgj(ysgjId);
            renderJson("{\"statusCode\":\"200\", \"message\":\"删除运输工具成功\", \"operationType\":\"delete\"}");
        } catch (Exception e){
            e.printStackTrace();
            renderJson("{\"statusCode\":\"300\", \"message\":\"" + e.getMessage()+ "\"}");
        }
    }
    public Long getWlsId() {
        return wlsId;
    }

    public void setWlsId(Long wlsId) {
        this.wlsId = wlsId;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    public Long getYsgjId() {
        return ysgjId;
    }

    public void setYsgjId(Long ysgjId) {
        this.ysgjId = ysgjId;
    }

    @Autowired
    public void setYsgjService(YsgjService ysgjService) {
        this.ysgjService = ysgjService;
    }
}
